package cn.iocoder.an.module.business.dal.mysql.auditplanarea;

import java.util.*;

import cn.iocoder.an.framework.common.pojo.PageResult;
import cn.iocoder.an.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.an.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.an.module.business.dal.dataobject.auditplanarea.AuditPlanAreaDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.an.module.business.controller.admin.auditplanarea.vo.*;

/**
 * 审核计划区域 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface AuditPlanAreaMapper extends BaseMapperX<AuditPlanAreaDO> {

    default PageResult<AuditPlanAreaDO> selectPage(AuditPlanAreaPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AuditPlanAreaDO>()
                .eqIfPresent(AuditPlanAreaDO::getLevelId, reqVO.getLevelId())
                .eqIfPresent(AuditPlanAreaDO::getStatus, reqVO.getStatus())
                .eqIfPresent(AuditPlanAreaDO::getWriteStatus, reqVO.getWriteStatus())
                .likeIfPresent(AuditPlanAreaDO::getAreaName, reqVO.getAreaName())
                .orderByDesc(AuditPlanAreaDO::getId));
    }

    default List<AuditPlanAreaDO> selectListByPlanId(Long planId) {
        return selectList(AuditPlanAreaDO::getPlanId, planId);
    }

    default int deleteByPlanId(Long planId) {
        return delete(AuditPlanAreaDO::getPlanId, planId);
    }

    default int deleteByPlanIds(List<Long> planIds) {
        return deleteBatch(AuditPlanAreaDO::getPlanId, planIds);
    }


}